//
//  Player.m
//  TabulaImaginarius
//
//  Created by TA2 on 3/25/11.
//  Copyright 2011 __MyCompanyName__. All rights reserved.
//

#import "Player.h"

@implementation Player

@synthesize ip;
@synthesize port;
@synthesize isHost;
@synthesize alias;
@synthesize currentlyMovingToken;

- (id)init {
	currentlyMovingToken = nil;
	return [super init];
}

- (void)dealloc {
	[super dealloc];
}

- (BOOL)isEqual:(id)other {
    if (other == self)
        return YES;
    if (!other || ![other isKindOfClass:[self class]])
        return NO;
    return [self isEqualToPlayer:other];
}

- (BOOL)isEqualToPlayer:(Player *)otherPlayer {
    if (self == otherPlayer)
        return YES;
    if (self.alias != otherPlayer.alias)
        return NO;
    if (self.ip != otherPlayer.ip)
        return NO;
	if (self.port != otherPlayer.port)
        return NO;
    return YES;
}

- (NSUInteger)hash {
    NSUInteger hash = 0;
    hash += [self.alias hash];
    hash += [self.ip hash];
	hash += self.port;
    return hash;
}

- (id)copyWithZone:(NSZone *)zone {
    return self;
}

@end
